package supermarket;
import java.io.Serializable;

/*
 * 商品的父类，包括商品的所有信息
 * */
public class Commodity implements Serializable {
    private String goodNum;// 商品编号
    private String goodName;// 商品名称
    private double goodPrice;// 商品单价
    private String goodVolume;// 商品单位
    private int goodCount;// 商品数量
    // 商品无参数构造方法

    public Commodity() {
    }

    public Commodity(String goodNum, int goodCount) {
        this.goodNum = goodNum;
        this.goodCount = goodCount;
    }

    // 商品有参数构造方法
    public Commodity(String goodsNum, String goodsName, double goodsPrice, String goodsVolume, int goodsCount) {
        this.goodNum = goodsNum;
        this.goodName = goodsName;
        this.goodPrice = goodsPrice;
        this.goodVolume = goodsVolume;
        this.goodCount = goodsCount;
    }

    public double getGoodprice() {
        return goodPrice;
    }

    public void setGoodprice(double goodprice) {
        if (goodprice > 0) {
            this.goodPrice = goodprice;
        } else {
            System.out.println("价格必须大于0");
        }
    }

    public String getGoodNum() {
        return goodNum;
    }

    public void setGoodNum(String goodNum) {
        this.goodNum = goodNum;
    }

    public String getGoodName() {
        return goodName;
    }

    public void setGoodName(String goodName) {
        this.goodName = goodName;
    }

    public String getGoodVolume() {
        return goodVolume;
    }

    public void setGoodVolume(String goodVolume) {
        this.goodVolume = goodVolume;
    }

    public int getGoodCount() {
        return goodCount;
    }

    public void setGoodCount(int goodCount) {
        this.goodCount = goodCount;
    }

}
